/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("tb_project_tsinfo",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MYData.Entity.DomainModels;
using MYData.System.IServices;
using MYData.Entity.DTO.ApiEntity.Input;
using System.Net;
using MYData.Core.Utilities;

namespace MYData.System.Controllers
{
    public partial class tb_project_tsinfoController
    {
        private readonly Itb_project_tsinfoService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public tb_project_tsinfoController(
            Itb_project_tsinfoService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
        /// <summary>
        /// 添加暂存信息表
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost,Route("InsertTsInfoAsync")]
        public async Task<IActionResult> InsertTsInfoAsync([FromBody]InsertBaseInfoTs_Dto inputDto)
        {
            return Json(await _service.InsertTsInfoAsync(inputDto));
        }

        /// <summary>
        /// 根据用户名获取该用户暂存信息
        /// </summary>
        /// <param name="TsSearch"></param>
        /// <returns></returns>
        [HttpPost, Route("TsInforSearch")]
        public async Task<IActionResult> TsInforSearch([FromBody]TsInforSearchDto TsSearch)
        {
            return Json(await _service.TsInforSearch(TsSearch));
        }

        [HttpGet,Route("GetTsBaseInfoById")]
        /// <summary>
        /// 根据暂存信息的ID查询暂存信息
        /// </summary>
        /// <param name="Id">暂存信息主键</param>
        /// <returns></returns>
        public  IActionResult GetTsBaseInfoById(string Id)
        {
            return Json( _service.GetTsBaseInfoById(Id));
        }
        /// <summary>
        /// 根据暂存id删除信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpPost, Route("DelTs")]
        public  IActionResult DelTs(string Id)
        {
            return Json( _service.DelTs(Id));
        }
    }
}
